home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / trubasic / rolldemos / chooser / util.tru < prev   
Text File  |  1994-08-02  |  2KB  |  81 lines

  1. external
  2. ! utilities for menu screens
  3. !--------------------------------------------------------------------
  4. sub expand(x1,x2,y1,y2)
  5.     set color "blue"
  6.     box area x1,x2,y1,y2
  7. end sub
  8.  
  9. sub unexpand(x1,x2,y1,y2)
  10.     set color "black"
  11.     box area x1,x2,y1,y2
  12.     set color 25
  13.     box lines x1,x2,y1,y2
  14. end sub
  15.  
  16. picture box(x1,x2,y1,y2,op)
  17.     ! foreground color
  18.     set color mix (25) 25/255,0,172/255
  19.     set color 25
  20.     let sinc=.05
  21.     
  22.     ! triangle for left and top shadow
  23.     plot area: x1-sinc,y1-sinc;x2+sinc,y2+sinc;x1-sinc,y2+sinc
  24.  
  25.     ! line from bottom left to top right
  26.     plot x1-sinc,y1-sinc;x1-sinc,y2+sinc
  27.  
  28.     ! right side line
  29.     plot x2+sinc,y2+sinc;x2+sinc,y1-sinc
  30.  
  31.     ! bottom line
  32.     plot x1-sinc,y1-sinc;x2+sinc,y1-sinc
  33.  
  34.     ! lower right diagonal line
  35.     plot x2,y1;x2+sinc,y1-sinc
  36.  
  37.     set color "black"
  38.  
  39.     ! button area
  40.     plot area: x1,y1;x1,y2;x2,y2;x2,y1
  41.  
  42.     ! upper left diagonal line
  43.     plot x1,y2;x1-sinc,y2+sinc
  44.     set color "blue"
  45.  
  46.     ! button area
  47.     !plot area: x1,y1;x1,y2;x2,y2;x2,y1
  48.     plot x1,y1;x1,y2;x2,y2;x2,y1;x1,y1
  49.  
  50. end picture
  51.  
  52. picture textbox(x1,x2,y1,y2,a$)
  53.     let x=(x2-x1) /2 + x1       
  54.     set color "white"
  55.     let sp=cpos(a$," ")
  56.     if sp=0 then
  57.         let y=(y2-y1) /2 + y1
  58.         plot text, at x,y:a$
  59.     else
  60.         let y=8*(y2-y1) /12 + y1       
  61.         plot text, at x,y:a$[1:sp]
  62.         let y=5*(y2-y1) /12 + y1       
  63.         let n=len(a$)
  64.         plot text, at x,y:a$[sp+1:n]
  65.     end if
  66. end picture
  67.  
  68. sub waitup
  69.     get mouse x,y,state
  70.     do while state<>0 or x>1 or x<0 or y>1 or y<0
  71.         get mouse x,y,state
  72.     loop
  73. end sub
  74.  
  75. sub waitclick
  76.     get mouse x,y,state
  77.     do while state=0
  78.         get mouse x,y,state
  79.     loop
  80. end sub
  81.